Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update expect.anything() example #5007

Merged
merged 2 commits into from
Dec 4, 2017

Conversation

alopezsanchez
Copy link
Contributor

Fixes: #4916

Summary
Update expect.anything() sample code. Calling [1].map(mock); fails because map adds two extra parameters to the mock call (index and array).

Test plan
expect-anything.test.js

test('map calls its argument with a non-null argument', () => {
  const mock = jest.fn();
  [1].map(x => mock(x));
  expect(mock).toBeCalledWith(expect.anything());
});
> jest "test/expect-anything.test.js"

 PASS  test/expect-anything.test.js
  ✓ map calls its argument with a non-null argument (5ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        0.592s, estimated 1s
Ran all test suites matching /test\/expect-anything.test.js/i.

@codecov-io
Copy link

codecov-io commented Dec 3, 2017

Codecov Report

Merging #5007 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #5007   +/-   ##
=======================================
  Coverage   60.31%   60.31%           
=======================================
  Files         198      198           
  Lines        6662     6662           
  Branches        3        3           
=======================================
  Hits         4018     4018           
  Misses       2644     2644

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4f1113c...bead437. Read the comment docs.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@cpojer cpojer merged commit ea3fabc into jestjs:master Dec 4, 2017
@cpojer
Copy link
Member

cpojer commented Dec 4, 2017

Thanks for fixing up our docs!

mjesun added a commit that referenced this pull request Dec 4, 2017
mjesun added a commit that referenced this pull request Dec 4, 2017
cpojer pushed a commit that referenced this pull request Dec 4, 2017
* Revert "docs: update expect.anything() example (#5007)"

This reverts commit ea3fabc.

* Revert "Emphasise required return (#4999)"

This reverts commit 4f1113c.

* Revert "Makes NPM a link like Yarn is (#4998)"

This reverts commit aa4f09d.

* Revert "Update Timeout error message to `jest.timeout` and display current timeout value (#4990)"

This reverts commit 08f8394.

* Revert "fix: jest-util should not depend on jest-mock (#4992)"

This reverts commit 4e2f41f.

* Revert "Update Troubleshooting.md (#4988)"

This reverts commit 6414f28.

* Revert "Revert "Add the Yammer logo to the 'who is using this' section of the website." (#4987)"

This reverts commit 91b104f.

* Revert "Make "weak" optional dependency and check it at runtime (#4984)"

This reverts commit e00529d.

* Revert "Re-inject native Node modules (#4970)"

This reverts commit ef55e89.
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expect.anything() error
5 participants